package com.corpgovernment.organization.dataloader;

import com.corpgovernment.api.basic.request.UserIdentityRequest;
import com.corpgovernment.api.basic.soa.UserRegisterClient;
import com.corpgovernment.api.basic.vo.MbUserRegisterResponseVO;
import com.corpgovernment.common.base.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Optional;

/**
 * @author jhxue
 */
@Component
public class UserRegisterClientDataloader {

	@Autowired
	private UserRegisterClient userRegisterClient;

	/**
	 * 获取用户身份信息
	 *
	 * @param request
	 * @return
	 */
	public MbUserRegisterResponseVO getAllIdentitySoa(UserIdentityRequest request) {
		if (request == null) {
			return null;
		}
		JSONResult<MbUserRegisterResponseVO> result = userRegisterClient.getAllIdentitySoa(request);
		return Optional.ofNullable(result).map(JSONResult::getData).orElse(null);
	}
}
